package model.entity.product;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "Brand")
public class Brand {
	
	private int brandId;
	private String name;
	private String logo;
	private String description;
	private List<Product> products = new ArrayList<Product>(0);

	public Brand() {
	}

	public Brand(String name) {
		this.name = name;
	}

	public Brand(String name, String logo, String description,
			List<Product> products) {
		this.name = name;
		this.logo = logo;
		this.description = description;
		this.products = products;
	}

	@Id
	@GeneratedValue(generator = "Brand_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "Brand_ID_Gen", sequenceName = "Brand_SEQ_ID")
	@Column(name = "BrandID", unique = true, nullable = false)
	public int getBrandId() {
		return this.brandId;
	}

	public void setBrandId(int brandId) {
		this.brandId = brandId;
	}

	@Column(name = "Name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "Logo")
	public String getLogo() {
		return this.logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	@Column(name = "Description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "brand")
	public List<Product> getProducts() {
		return this.products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

}
